import java.util.Scanner;

public class CompanyTest {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        Company co = new Company();
        co.companyName = "第一科技公司";
        co.address = "地球";
        co.phoneNumber = "0123-4567";
        co.manage = "科技";
        System.out.println("公司名称：" + co.companyName + "\n注册地址：" + co.address + "\n电话：" + co.phoneNumber + "\n经营范围：" + co.manage);
        while (true) {
            System.out.println("|1.招聘员工|2.输出员工信息|3.辞退员工|4.统计公司人数|5.查薪水最高|6.从大到小排序|7.员工平均工资|8.涨工资|9.退出|");
            int choose = scan.nextInt();
            switch (choose) {
                case 1: {
                    People pe = new People();
                    System.out.println("请输入招聘的员工姓名");
                    pe.name = scan.next();
                    System.out.println("请输入招聘的员工薪水");
                    pe.money = scan.nextInt();
                    co.add(pe);
                    break;
                }
                case 2: {
                    co.show();
                    break;
                }
                case 3: {
                    System.out.println("请输入辞退的员工姓名");
                    String deleteName = scan.next();
                    boolean a = co.delete(deleteName);
                    if (a) {
                        System.out.println("已经辞退");
                    } else {
                        System.out.println("查无此人");
                    }
                    break;
                }
                case 4: {
                    System.out.println("公司现在有" + co.statistics() + "人");
                    break;
                }
                case 5: {
                    System.out.println("薪水最高的是" + co.findSalary());
                    break;
                }
                case 6: {
                    System.out.println("从大到小排序为：");
                    co.sortSalary();
                    System.out.println();
                    break;
                }
                case 7: {
                    if (co.avg() < 0) {
                        System.out.println("没有员工");
                    } else {
                        System.out.println("平均工资是：" + co.avg());
                    }
                    break;
                }
                case 8: {
                    co.raise();
                    break;
                }
                case 9: {
                    System.out.println("退出成功");
                    return;
                }
            }
        }
    }
}